//- Copyright (C) 2018-2022 Chatopera Inc, <https://www.chatopera.com>
//- 
//- Licensed under the Apache License, Version 2.0 (the "License");
//- you may not use this file except in compliance with the License.
//- You may obtain a copy of the License at
//- 
//-  http://www.apache.org/licenses/LICENSE-2.0
//- 
//-  Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
extends /apps/include/layout.pug

block content
    .layui-side.layui-bg-black
        .layui-side-scroll
            include /apps/service/include/left.pug
    .layui-body
        .layui-side-scroll
            .row
                .col-lg-12
                    h1.site-h1(style='border-top:1px solid #e6e6e6;')
                        | 满意度评价 #{serviceList && serviceList.totalElements ? "（ " + serviceList.totalElements + "）": "（0）"}
                    table.layui-table(lay-skin='line', style='table-layout: fixed; word-break: break-all;')
                        thead
                            tr.design-sortable-tr
                                th 用户名
                                th(width='60px') 接入渠道
                                th 服务坐席
                                th 咨询时间
                                th 评价时间
                                th(width='70px') 评价
                                th 回复意见
                        tbody
                            if serviceList.content.size() > 0
                                for agentService in serviceList.content
                                    tr.tdHasContorllor.design-dropable-td
                                        td.first_td_head(title= agentService.username, style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;")
                                            a(href="/service/online/index.html?userid=" + agentService.userid + "&agentservice=" + agentService.id) #{agentService.username}
                                        td #{agentService.channel}
                                        td(title= agentService.agentusername, style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;") #{agentService.agentusername}
                                        td #{pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', agentService.servicetime)}
                                        td #{pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', agentService.satistime)}
                                        td
                                            for comment in uKeFuDic['com.dic.webim.comment']
                                                if agentService.satislevel && comment.code == agentService.satislevel
                                                    | #{comment.name}
                                        td #{agentService.satiscomment && uKeFuDic[agentService.satiscomment] ? uKeFuDic[agentService.satiscomment].name : agentService.satiscomment}
                            else
                                tr
                                    td(colspan="7" style="height:400px;")
                                        .ukefu-empty(style="background: none")
                                            i.layui-icon &#xe63a;
                                            div() 还没有满意度评价
            .row(style='padding:5px;')
                .col-lg-12#page(style='text-align:center;')

    script.
        layui.use(['laypage', 'layer'], function(){
                  var laypage = layui.laypage
                  ,layer = layui.layer;

                  laypage({
                        cont: 'page'
                        ,pages: #{serviceList ? serviceList.totalPages : 0} //总页数
                        ,curr: #{serviceList ? serviceList.number + 1 : 0}
                        ,groups: 5 //连续显示分页数
                        ,jump:function(data , first){
                            if(!first){
                                location.href = "/service/comment/index.html?p="+data.curr;
                            }
                        }
                   });
                });
            
